package com.hishop.coupon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hishop.common.utils.PageUtils;
import com.hishop.coupon.dao.CouponHistoryDao;
import com.hishop.coupon.entity.CouponHistoryEntity;
import com.hishop.coupon.service.CouponHistoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service("couponHistoryService")
public class CouponHistoryServiceImpl extends ServiceImpl<CouponHistoryDao, CouponHistoryEntity> implements CouponHistoryService {

    @Resource
    private CouponHistoryDao couponHistoryDao;

    @Override
    public PageUtils queryPage(String key, Page<CouponHistoryEntity> page) {
        QueryWrapper<CouponHistoryEntity> qw = new QueryWrapper<>();
        if (!key.equals("")) {
            qw.like("id", key)
                    .or().like("member_nick_name",key)
            ;
        }
        return new PageUtils(couponHistoryDao.selectPage(page,qw));
    }

}